/**
 * 
 */
package actions;

import java.awt.event.ActionEvent;
import java.awt.event.KeyEvent;

import findandrepl.FindAndReplace;


/**
 * Action to create Find and Replace Dialog
 * @author Ashley Polkinghorn
 *
 */
public class FindReplaceAction extends AwesomeMenuAction {

	/**
	 * Find and Replace objects
	 */
	FindAndReplace repl=null;
	
	/**
	 * 
	 * @param name
	 * @param desc
	 */
	public FindReplaceAction(String name, String desc)
	{
		super(name, desc);
		putValue(MNEMONIC_KEY, new Integer(KeyEvent.VK_F));
	}

	/**
	 * Show dialog. If first time, create it.
	 * Otherwise, just make it visible.
	 */
	@Override
	public void actionPerformed(ActionEvent arg0) {
		if(repl == null)
		{
			repl = new FindAndReplace(getSelectedTextPane(arg0), this.getSelectedTextPanel(arg0));
		}
		repl.setVisible(true);
	}

}
